package io.lkt.modules.sys.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.lkt.common.utils.PageUtils;
import io.lkt.common.utils.Query;
import io.lkt.commons.dynamic.datasource.annotation.DataSource;
import io.lkt.modules.sys.dao.KeywordDetailLogDao;
import io.lkt.modules.sys.dao.PushHeadLogDao;
import io.lkt.modules.sys.entity.KeywordDetailLogEntity;
import io.lkt.modules.sys.entity.KeywordSumLogEntity;
import io.lkt.modules.sys.entity.KeywordSummaryEntity;
import io.lkt.modules.sys.entity.PushHeadLogEntity;
import io.lkt.modules.sys.service.KeywordDetailLogService;
import io.lkt.modules.sys.service.PushHeadLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;


@Service("KeywordDetailLogService")
public class KeywordDetailLogServiceImpl extends ServiceImpl<KeywordDetailLogDao, KeywordDetailLogEntity> implements KeywordDetailLogService {
    @Autowired
    private KeywordDetailLogDao keywordDetailLogDao;

    @Override
    @DataSource("logdb")
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<KeywordDetailLogEntity> page = this.page(
                new Query<KeywordDetailLogEntity>().getPage(params),
                new QueryWrapper<KeywordDetailLogEntity>()
        );

        return new PageUtils(page);
    }

    @Override
    @DataSource("logdb")
    public List<KeywordSumLogEntity> queryList(Map<String, Object> map) {
        return keywordDetailLogDao.queryList(map);
    }

    @Override
    @DataSource("logdb")
    public Integer queryTotal(Map<String, Object> map) {
        return keywordDetailLogDao.queryTotal(map);
    }

    @Override
    @DataSource("logdb")
    public PageUtils queryDetPage(Map<String, Object> params) {
        IPage<KeywordDetailLogEntity> page = this.page(
                new Query<KeywordDetailLogEntity>().getPage(params),
                new QueryWrapper<KeywordDetailLogEntity>()
        );

        return new PageUtils(page);
    }

    @Override
    public List<KeywordDetailLogEntity> queryDetList(Map<String, Object> map) {
        return keywordDetailLogDao.queryDetList(map);
    }

    @Override
    @DataSource("logdb")
    public Integer queryDetTotal(Map<String, Object> map) {
        return keywordDetailLogDao.queryDetTotal(map);
    }

    @Override
    //@DataSource("logdb")
    public List<KeywordDetailLogEntity> getUserKeyword(Map<String, Object> map) {
        return keywordDetailLogDao.getUserKeyword(map);
    }

    @Override
    @DataSource("logdb")
    public Integer getUserKeywordTotal(Map<String, Object> map) {
        return keywordDetailLogDao.getUserKeywordTotal(map);
    }

    @Override
    @DataSource("logdb")
    public KeywordSummaryEntity getKeywordSummay(Map<String, Object> map) {
        return baseMapper.getKeywordSummay(map);
    }


}
